﻿using System;

namespace DotNetRepository
{
    [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)]
    public class PersistanceOptionsAttribute : Attribute
    {
        public bool SaveWithEntity = true;
        public bool DeleteWithEntity;
    }

    public static class PersistanceOptionsAttributeExtensions
    {
        public static bool SaveWithEntityNotNull (this PersistanceOptionsAttribute poa)
        {
            return poa != null && poa.SaveWithEntity;
        }

        public static bool DeleteWithEntityNotNull(this PersistanceOptionsAttribute poa)
        {
            return poa != null && poa.DeleteWithEntity;
        }
    }
}
